/**
 * ATuanZhang
 */
package org.huanglei.android.inject.provider;

import android.content.Context;

import com.google.inject.Inject;
import com.google.inject.Provider;


/**
 * @author huanglei
 * @date 2011-3-28 @
 */
public class SystemServiceProvider<T> implements Provider<T> {

	@Inject
	protected Provider<Context> contextProvider = null;

	protected String serviceName = null;

	public SystemServiceProvider(String serviceName) {
		this.serviceName = serviceName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.google.inject.Provider#get()
	 */
	@SuppressWarnings("unchecked")
	@Override
	public T get() {
		return (T) contextProvider.get().getSystemService(serviceName);
	}

}
